#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPushButton>
#include <QLabel>
#include <QPixmap>
#include <QPainter>
#include <QTimer>
#include <QDateTime>

#include<QMessageBox>
#include <QCloseEvent>
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;

    QLabel *imageLabel;
    QPixmap pixmap;
    QTimer* timer;
public:
    void MainWindow::closeEvent(QCloseEvent *event)
    {
        timer->stop(); // 停止定时器
        imageLabel->close();
        QMainWindow::closeEvent(event);
        event->accept(); // 允许关闭窗口
    }

private slots:
    void openImage();
};

#endif // MAINWINDOW_H
